home *** CD-ROM | disk | FTP | other *** search
- ;Program PRSELECT.ASM
- ;Memory resident. Allows you to switch LPT1:
- ;and LPT2: by pressing Ctrl, Alt and one of
- ;the shift keys
- ;
- ;By Jim Dexter
- ; 2400 Westmont Way West
- ; Seattle, WA 98199
- ; (206) 285-3039
- ;
- base segment at 0
- org 24h
- st1 dw ? ;Address of
- st2 dw ? ;keyboard interrupt
- base ends
- data segment at 40h
- dw 4 dup (?)
- pr1 dw ? ;Port for lpt1
- pr2 dw ? ;Port for lpt2
- data ends
- swappr segment
- assume cs:swappr
- org 100h
- get_ports:
- mov ax,40h ;Find printer ports
- mov ds,ax ;and store them
- mov ax,ds:pr1
- mov cs:lpt1,ax
- mov ax,ds:pr2
- mov cs:lpt2,ax
- patch_dos:
- mov dx,offset endup ;Add memory resident
- mov ax,0 ;portion of program
- mov ds,ax ;to DOS
- mov ax,ds:st1
- mov cs:st1a,ax
- mov ax,ds:st2
- mov cs:st2a,ax
- mov ax,offset startit
- mov ds:st1,ax
- mov ax,cs
- mov ds:st2,ax
- int 27h
- startit:
- push ax ;This routine is now
- push ds ;called each time
- mov ax,40h ;interrupt 9 is called
- mov ds,ax
- mov al,ds:[17h] ;Get status of keys
- and al,0fh
- cmp al,0eh
- jz l_shift ;Jump if control,
- cmp al,0dh ;alternate and a
- jz r_shift ;shift key are pressed
- jmp goback ;otherwise return
- l_shift:
- mov ax,cs:lpt1 ;Set LPT1: and LPT2:
- mov ds:pr1,ax ;to original settings
- mov ax,cs:lpt2
- mov ds:pr2,ax
- jmp goback
- r_shift:
- mov ax,cs:lpt2 ;Set LPT1: and LPT2:
- mov ds:pr1,ax ;to reversed settings
- mov ax,cs:lpt1
- mov ds:pr2,ax
- goback: ;Return to normal routine for
- pop ds ;interrupt 9
- pop ax
- db 0eah ;This creates a jump statement
- st1a dw ? ;back to ROM BIOS
- st2a dw ?
- lpt1 dw ?
- lpt2 dw ?
- endup dw ?
- swappr ends
- end get_ports
-